package com.example.springdemo.mapstruct;

import com.example.springdemo.domain.reqVo.ReqAddUser;
import com.example.springdemo.domain.reqVo.ReqUpdateUser;
import com.example.springdemo.domain.table.User;
import org.mapstruct.AfterMapping;
import org.mapstruct.BeforeMapping;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;

import java.util.List;

/**
 * IUser
 *
 * @author : wenguang
 * @date : 2021/11/18 15:00
 */
@Mapper(componentModel = "spring")
public interface IUserMap {

    //    @Mapping(source = "phone",target = "phoneNumber")
//    @Mapping(source = "birthday",target = "birthday",dateFormat = "yyyy-MM-dd")
    User toUserDo(ReqAddUser member);

    User toUserDo(ReqUpdateUser member);

    List<User> toUserDoes(List<ReqUpdateUser> member);

    @BeforeMapping
    default void beforeMapping(ReqAddUser product) {

    }

    @AfterMapping
    default void afterMapping(@MappingTarget User productDto) {

    }

}
